CC = gcc
INCLUDE_DIR = ./include
SRC_DIR = ./src
OBJ_DIR = ./obj
EXECUTABLE = $(OBJ_DIR)/my_server
CPEXECUTABLE = ..

CFLAGS = -I$(INCLUDE_DIR)
LDFLAGS = -pthread -lsqlite3

SRCS := $(wildcard $(SRC_DIR)/*.c)
OBJS := $(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.o,$(SRCS))

.PHONY: all clean

all: $(EXECUTABLE)

$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c
	$(CC) $(CFLAGS) -c $< -o $@

$(EXECUTABLE): $(OBJS)
	$(CC) $(OBJS) -o $@ $(LDFLAGS) && cp $@ .

clean:
	rm -rf $(OBJ_DIR)/*
